package test.api.gridfs;

import java.io.File;
import java.io.IOException;

import test.api.MongoDb;

import com.mongodb.DB;
import com.mongodb.gridfs.GridFS;
import com.mongodb.gridfs.GridFSInputFile;

public class GridFSDao {
	public void save(String fileUri) throws IOException{
		DB mydb = MongoDb.getInstance().getDb();
		File f = new File(fileUri);  
        GridFS myFS = new GridFS(mydb);               
        GridFSInputFile inputFile = myFS.createFile(f);  
//        inputFile.setMetaData(metadata);
        inputFile.save();  
//        System.out.println("done");
	}
	
	public static void main(String[] args) throws IOException {
		
	}

}
